<script src="/kissy/build/seed-debug.js"></script>
<script src="command.js"></script>
<script src="/kissy/src/package.js"></script>
<button id="render">render</button>
<textarea id="content" style="width: 100%;height: 400px"></textarea>
<script>
    var data;
    KISSY.config('packages', {
        xtpl: {
            base: './xtpl'
        }
    });

    KISSY.use(['io', 'xtemplate/runtime', 'xtpl/item-collect'], function (S, IO, XTemplate, xtpl) {
        var num = 1000;

        IO({
            url: 'data.json',
            async: false,
            success: function (d) {
                data = d;
            }
        });

        addMyCommand(XTemplate);

        var t = new XTemplate(xtpl);

        document.getElementById('render').onclick = function () {
            var start = (+new Date());

            for (var i = 0; i < num; i++) {
                var ret = t.render(data);
            }

            S.log((+new Date()) - start);
            document.getElementById('content').value = ret;
        };
    });
</script>